package stateAAs 
{
	import org.agony2d.Agony;
	import org.agony2d.gpu.ImageAA;
	import org.agony2d.gpu.StateAA;
	import org.agony2d.gpu.TintedImageAA;
	import org.agony2d.notify.AEvent;

public class TintedImage_StateAA extends StateAA 
{
	
	/** overwritable... */
	override public function get smoothing() : Boolean {
		return true
	}
	
	/** overwritable... */
	override public function get tinted() : Boolean {
		return true
	}
	
	/** overwrite... */
	override public function get fullTexture() : String {
		return "A_32"
	}
	
	/** overwrite... */
	override public function enter() : void {
		//var image:ImageAA
		var image:TintedImageAA
		var i:int
		
		mLength = this.stateArgs[0]
		
		while (i < mLength) {
			//image = new ImageAA
			image = new TintedImageAA
			
			image.x = 50 + Math.random() * 660
			image.y = 70 + Math.random() * 320
			image.pivotX = 16
			image.pivotY = 16
			image.scaleX = image.scaleY = 1.25
			image.rotation = Math.random() * 180
			image.color = 0xFFFFFF * Math.random()
			image.alpha = Math.random() * 0.9 + 0.1
			this.group.addNode(image)
			image.textureData = FULL_TEX
			mImgList[i++] = image
		}
		
//		this.group.alpha = 0.8
		Agony.process.addEventListener(AEvent.ENTER_FRAME, update)
	}
	
	
	/** overwrite... */
	override public function exit() : void {
		
	}
	
	
	private var mImgList:Array = []
	private var mLength:int
	
	
	private function update(e:AEvent):void {
		var image:TintedImageAA
		var i:int
		
		while (i < mLength) {
			image = mImgList[i++];
			image.rotation += 4
		}
	}
}

}